
using System;
using System.Collections.Generic;

namespace InfiniTec.Threading
{
    public class NestedOperation: OperationAction
    {
        private readonly AsyncOperation _Operation;
        private readonly List<Type> _ExceptionsToHandle;
        public List<Type> ExceptionsToHandle { get { return _ExceptionsToHandle; } }

    	public NestedOperation(AsyncOperation operation, params Type[] exceptionsToHandle)
        {
            if (exceptionsToHandle == null) throw new ArgumentNullException("exceptionsToHandle");

            _Operation = operation;
            _ExceptionsToHandle = new List<Type>(exceptionsToHandle);
        }

        public NestedOperation(AsyncOperation operation)
        {
            if (operation == null)
            {
                throw new ArgumentNullException("operation");
            }

            _Operation = operation;
            _ExceptionsToHandle = new List<Type>();
        }


        public AsyncOperation Operation { get { return _Operation; } }

    }
}